﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;

namespace Gmantis.Controls.Chart
{
    public class DotSymbol : Symbol
    {
        // Methods
        public DotSymbol()
        {
            base.geometry = base.Data = new EllipseGeometry();
        }

        internal override object Clone()
        {
            DotSymbol clone = new DotSymbol();
            base.CloneAttributes(clone);
            return clone;
        }

        protected override void UpdateGeometry(PathGeometry pg, Size sz)
        {
            double num = 0.5 * this.Size.Width;
            double num2 = 0.5 * this.Size.Height;
            double num3 = 0.5 * base.StrokeThickness;
            EllipseGeometry geometry = (EllipseGeometry)base.geometry;
            geometry.RadiusX = num;
            geometry.RadiusY = num2;
            geometry.Center = new Point(num + num3, num2 + num3);
            Canvas.SetLeft(this, (this.symCenter.X - num) - num3);
            Canvas.SetTop(this, (this.symCenter.Y - num2) - num3);
        }

        // Properties
        protected override Shape LegendShape
        {
            get
            {
                Ellipse shape = new Ellipse();
                base.AdjustLegendShape(shape);
                return shape;
            }
        }
    }
}
